home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Cre8tapp.pxl < prev    next >
Text File  |  2001-10-05  |  40KB  |  1,054 lines

  1. {-------------------------------------------------------------------------------------------------------------------
  2.     Filename    : cre8tapp.pxl
  3.     Purpose    : make application source code helper
  4.     Date        : October 2001
  5.     Author        : S.Dibbs, VYSOR Integration Inc
  6.     
  7.     May be freely adapted to suit your own development needs. 
  8.     Let us know what you have changed and adapted. What is 
  9.     useful to you may well be useful to other PiXCL users. !
  10. --------------------------------------------------------------------------------------------------------------------}
  11.  
  12. Initialize:
  13. { Get the screen parameters and adjust the main window for a fixed size. }
  14.  
  15.     Audio = 1 { set this to 0 to disable the WAV file audio instructions}
  16.     AudioState$ = "Audio &Off"
  17.  
  18.     Title$ = "PiXCL Code Writer Helper"
  19.     UseCaption(Title$)
  20.     UseCoordinates(PIXEL)    
  21.     WinLocate(Title$,380,150,790,300, Res)
  22.  
  23.     {Get the source directory: this is the same as the PiXCL samples
  24.       directory, where all Helper applications should be stored. Also get the 
  25.      current working directory.  Access the Registry to do this. }
  26.  
  27.     GoSub GetWorkingDirectory
  28.  
  29.     CodeFile$ = SourceDir$ + "\user1_12.pxl"
  30.     FileExist(CodeFile$,Res)
  31.     If Res = 1
  32.         FileGetSize(CodeFile$,Size)
  33.         FileRead_ASCII(CodeFile$,0,Size,Code$,Res)
  34.     Else
  35.         MessageBox(OK,1,STOP,
  36.         "Unable to proceed with source creation. Please locate the above file.", CodeFile$,Res)
  37.         End
  38.     Endif
  39.     
  40.     InfoMenu(REMOVE)
  41.     WaitInput(1)
  42.     Gosub RedrawMenu
  43.     SetMenu("E&xit!",Terminate,
  44.         ENDPOPUP,
  45.         "&Start New App",StartCreateCode,
  46.         ENDPOPUP,
  47.         "&Add Dialog Code",AddDialogCode,
  48.         ENDPOPUP,
  49.         AudioState$, SetAudioState,
  50.         ENDPOPUP,
  51.         "&Help",ShowAppHelp,
  52.         ENDPOPUP)
  53.  
  54.     SetExitFlag = 0
  55.  
  56. Wait_for_input:
  57.     WaitInput()
  58.  
  59. SetAudioState:
  60.     If Audio = 1
  61.         Audio = 0
  62.         AudioState$ = "Audio &On"
  63.     Else
  64.        Audio = 1
  65.         AudioState$ = "Audio &Off"
  66.     Endif
  67.      Gosub RedrawMenu
  68.     Goto Wait_for_input
  69.  
  70. RedrawMenu: {subroutine}
  71.         SetMenu("E&xit!",Terminate,
  72.         ENDPOPUP,
  73.         "&Start New App",StartCreateCode,
  74.         ENDPOPUP,
  75.         "&Add Dialog Code",AddDialogCode,
  76.         ENDPOPUP,
  77.         AudioState$, SetAudioState,
  78.         ENDPOPUP,
  79.         "&Help",ShowAppHelp,
  80.         ENDPOPUP)
  81.     Return
  82.  
  83. Terminate:
  84.     If SetExitFlag = 0 Then DrawBackground     End
  85.     Filter$ = "PiXCL files(*.pxl),*.pxl"
  86.     FileSaveAs(Filter$,"*.pxl",WorkingDir$,"Save the new PiXCL skeleton file", 
  87.                  NOCHANGEDIR, NewCodeFile$)
  88.     If NewCodeFile$ = "" Then Goto Wait_for_input {do nothing}
  89.  
  90.     FileExist(NewCodeFile$,Res)
  91.     If Res = 1
  92.         MessageBOX(YESNO,1,QUESTION,
  93.         "This source file already exists. Do you want to overwrite it ?",NewCodeFile$,Res)
  94.     Endif
  95.     If Res = 2 Then Goto Terminate
  96.  
  97.     GoSub AdjustStandardCode
  98.  
  99.     Len(Code$,Long)
  100.     FileDelete(NewCodeFile$,Res)
  101.     FileWrite_ASCII(NewCodeFile$,0,Long,Code$,Res)
  102.  
  103.     DropFileServerExt(ENABLE,FILES,NewCodeFile$)
  104.     
  105.     DrawIcon(20,40,0,0,ICON17) 
  106.     GoSub SetFontColor
  107.     DrawTextExt(60,40,400,200,"Drag and Drop into the MDI Editor, then click here again to close this Helper App.",LEFT)
  108.     SetMouse(0,0,400,400,ClearDFS,X,Y)
  109.     Goto Wait_for_Input
  110.  
  111. ClearDFS:
  112.     DropFileServer(DISABLE,"")
  113. Leave:
  114.     Step += Audio
  115.     If Step = 9 Then WAVPlaySound("therenow.wav",SYNC,FILENAME,Res)
  116.     DrawBackground
  117.     End
  118.  
  119. ShowAppHelp: 
  120.     GoSub ShowAppHelpMsgBox
  121.     Goto Wait_for_input
  122.  
  123. StartCreateCode:
  124.     UseStatusBar = 0
  125.     UseToolbar = 0
  126.     FileDragAccept = 0
  127.     SetExitFlag = 1
  128.     UseBackground(TRANSPARENT,255,255,255)
  129.     DrawBackground
  130.     If Audio = 1 Then WAVPlaySound("step1.wav",ASYNC,FILENAME,Res)
  131.     MessageBox(OKCANCEL,1,EXCLAMATION,
  132. "Using the mouse, move and size the Helper application window
  133. to where you want the initial position of your application to be, 
  134. then click the mouse anywhere in the client area.
  135.  
  136. The position will be saved in the helper, and later written in to the 
  137. PiXCL code that gets created.
  138.  
  139. Click Cancel to terminate this Helper App.",
  140.     "Step #1: Set the size and position of the application window.",Res)
  141.  
  142.     If Res = 2 Then Goto Leave
  143.     SetMouse(0,0,1280,1024,SetPositionDone,n,n)
  144.     DrawTextExt(20,40,180,180,"Click in the client area when the position and size are correct.",LEFT)
  145.     Goto Wait_for_input
  146.  
  147. SetPositionDone:
  148.     DrawBackground
  149.     WinGetLocation(Title$,app_x1,app_y1,app_x2,app_y2,Res)
  150.     Text$ = "Enter the single line window title that will appear in your program's TitleBar. This cannot be a null string."
  151.     Label$ = "Step #2: Set the Application Title string"
  152.     AppTitle$ = "PiXCL Application Title"
  153.     Purpose$ = "<purpose>"
  154.     Author$ = "<author name (optional: company)>"
  155.  
  156.     Msg$ = "Please enter the title, purpose and author's name."
  157.     Info$ = "Information"
  158.     MoreInfo$ = "Once all details are entered, these strings are written into the App source code, plus today's date."
  159.  
  160.     If Audio = 1 Then WAVPlaySound("step2.wav",ASYNC,FILENAME,Res)
  161.     DialogBox(20,20,250,120,Label$,CAP_CTR,
  162.                350,110, 64,64, ICON01, 
  163.                170,35,220,50,"&Next",   7,   Res,
  164.                170,15,220,30,BTN,PUSH,"&Cancel",  
  165.                 25,2,205,14,STATIC, LEFT, Msg$ ,
  166.                 4,15,160,27,EDIT,STRING,AppTitle$,AppTitle$,
  167.                 4,30,160,42,EDIT,STRING,Purpose$,Purpose$,
  168.                 4,45,160,57,EDIT,STRING,Author$,Author$,
  169.                 4,58,150,98,BTN,GROUP,Info$,
  170.                 8,66,148,96,STATIC,LEFT,MoreInfo$)
  171.  
  172.     If Res = 1 Then Goto Leave
  173.     If AppTitle$ = "" Then Goto SetPositionDone
  174.  
  175.     UseCaption(AppTitle$)
  176.  
  177.  
  178.     Msg1$ = "Click Yes to create a multi-part StatusBar at the bottom of the client area of your application. The format you select will appear on the Helper App.
  179.  
  180. Click No to continue. No StatusBar will be created.  Click Cancel to terminate this Helper App. The StatusBar details will be saved, and later written into the PiXCL code that gets created."
  181.  
  182.     
  183.     Field1$ = "200"
  184.     Field2$ = "1"
  185.     Field3$ = "0"
  186.     Field4$ = "0"
  187.  
  188.     If Audio = 1 Then WAVPlaySound("step3.wav",ASYNC,FILENAME,Res)
  189.     DialogBox(10,20,260,120,"Step #3: Do you want a StatusBar ?",CAP_NCTR,
  190.                400,140, 64,64, WINLOGO, 
  191.                190,10,240,25,"&Yes",   8,   Res,
  192.                190,30,240,45,BTN,PUSH,"&No",  
  193.                190,50,240,65,BTN,PUSH,"&Cancel",  
  194.                 25,2,185,67,STATIC, LEFT, Msg1$,
  195.                 15,68,185,73,BTN,GROUP,"",
  196.                 20,75,41,87,EDIT,NUMBER,Field1$,xField1$,
  197.                 42,75,63,87,EDIT,NUMBER,Field2$,xField2$,
  198.                 64,75,85,87,EDIT,NUMBER,Field3$,xField3$,
  199.                 86,75,106,87,EDIT,NUMBER,Field4$,xField4$)
  200.  
  201.  
  202.     If Res = 2 Then Goto Leave
  203.  
  204.     If Res = 0
  205.         UseStatusBar = 1
  206.  
  207.         If xField1$ = "1" Then xField1$ = "-1"  
  208.         If xField2$ = "1" Then xField2$ = "-1"  
  209.         If xField3$ = "1" Then xField3$ = "-1"  
  210.         If xField4$ = "1" Then xField4$ = "-1"  
  211. {
  212.         If xField1$ = "-1" Then DebugMsgBox("Field#1  = -1")
  213.         If xField2$ = "-1" Then DebugMsgBox("Field#2  = -1")
  214.         If xField3$ = "-1" Then DebugMsgBox("Field#3  = -1")
  215.         If xField4$ = "-1" Then DebugMsgBox("Field#4  = -1")
  216. }
  217.         Val(xField1$,Field1,Res)
  218.         Val(xField2$,Field2,Res)
  219.         Val(xField3$,Field3,Res)
  220.         Val(xField4$,Field4,Res)
  221.         Panes = 4
  222.         If Field4 = -1 Then Panes = 4
  223.         If Field3 = -1 Then Panes = 3
  224.         If Field2 = -1 Then Panes = 2
  225.         If Field1 = -1 Then Panes = 1 Field1 = -1 {defaults}
  226.         Str(Panes,Panes$)
  227.  
  228.         StatusWindow(ENABLE,BOTTOM,Panes,Field1,Field2,Field3,Field4)
  229.     Endif
  230.  
  231.     If Audio = 1 Then WAVPlaySound("step4.wav",ASYNC,FILENAME,Res)
  232.     MessageBox(OKCANCEL,1,QUESTION,
  233. "The default color is white (RGB: 255,255,255).  Click OK and a color 
  234. select dialog will appear. Select a standard color, or create a custom
  235. color for the background. 
  236.  
  237. This color will set the Helper App background, and will appear in
  238. the PiXCL code created later.
  239.  
  240. Click Cancel to terminate this Helper App.",
  241.     "Step #4: Set the client area background color",Res)
  242.  
  243.     If Res = 2 Then Goto Leave
  244.  
  245.     Red = 255 Green = 255 Blue = 255
  246.     ChooseColor(SMALLRGB,Red,Green,Blue)
  247.     If Red = -1 Then Goto Leave
  248.  
  249.     UseBackground(TRANSPARENT,Red,Green,Blue)
  250.     DrawBackground
  251.  
  252. {Use a custom dialog that asks for LARGE/SMALL, RAISED/FLAT mode}
  253.  
  254. Msg$ = 
  255. "Do you want to have a default toolbar button set ?
  256.  
  257. Click Yes to create a standard toolbar button set. You will need to edit the code that is created later to add extra toolbar buttons and button processing. Select the small or large, raised or flat button styles.
  258.  
  259. Click No to continue.
  260.  
  261. Click Cancel to terminate this Helper App."
  262.  
  263.     If Audio = 1 Then WAVPlaySound("step5.wav",ASYNC,FILENAME,Res)
  264.     ToolSize1 = 1    {this sets the default style}
  265.     DialogBox(80,80,280,250,"Step #5: Defining a toolbar",CAP_CTR,
  266.                5,5,37,37,QUESTION,
  267.               30,145,70,157,"&Yes",7,Res,
  268.               80,145,120,157,BTN,PUSH,"&No",
  269.               130,145,170,157,BTN,PUSH,"&Cancel",
  270.               30,5,190,130,STATIC,LEFT,Msg$,
  271.               30,92,120,102,BTN,AUTORADIO,"Small / Raised",ToolSize1,
  272.               30,105,120,115,BTN,AUTORADIO,"Small / Flat",ToolSize2,
  273.               30,118,120,128,BTN,AUTORADIO,"Large / Raised",ToolSize3,
  274.               30,131,120,141,BTN,AUTORADIO,"Large / Flat",ToolSize4)
  275.               
  276.     If Res = 0
  277.         UseToolbar = 1
  278.         If ToolSize1 = 1
  279.             Toolbar(RAISED, PXL_SMALL,
  280.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  281.         PXL_NEW, ENABLED, STD, "FileNew", CreatingFile,
  282.         PXL_OPEN, ENABLED, STD, "FileOpen", OpeningFile,
  283.         PXL_SAVE, ENABLED, STD, "FileSave", SavingFile,
  284.         SAVEALL,  ENABLED, STD,"Save All", SavingAllFiles,
  285.         PXL_PRINT,  ENABLED, STD,"PrintFile", PrintingFile,
  286.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  287.         HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp)
  288.         Endif
  289.  
  290.         If ToolSize2 = 1
  291.             Toolbar(FLAT, PXL_SMALL,
  292.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  293.         PXL_NEW, ENABLED, STD, "FileNew", CreatingFile,
  294.         PXL_OPEN, ENABLED, STD, "FileOpen", OpeningFile,
  295.         PXL_SAVE, ENABLED, STD, "FileSave", SavingFile,
  296.         SAVEALL,  ENABLED, STD,"Save All", SavingAllFiles,
  297.         PXL_PRINT,  ENABLED, STD,"PrintFile", PrintingFile,
  298.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  299.         HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp)
  300.         Endif
  301.  
  302.         If ToolSize3 = 1
  303.             Toolbar(RAISED, PXL_LARGE,
  304.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  305.         PXL_NEW, ENABLED, STD, "FileNew", CreatingFile,
  306.         PXL_OPEN, ENABLED, STD, "FileOpen", OpeningFile,
  307.         PXL_SAVE, ENABLED, STD, "FileSave", SavingFile,
  308.         SAVEALL,  ENABLED, STD,"Save All", SavingAllFiles,
  309.         PXL_PRINT,  ENABLED, STD,"PrintFile", PrintingFile,
  310.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  311.         HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp)
  312.         Endif
  313.  
  314.         If ToolSize4 = 1
  315.             Toolbar(FLAT, PXL_LARGE,
  316.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  317.         PXL_NEW, ENABLED, STD, "FileNew", CreatingFile,
  318.         PXL_OPEN, ENABLED, STD, "FileOpen", OpeningFile,
  319.         PXL_SAVE, ENABLED, STD, "FileSave", SavingFile,
  320.         SAVEALL,  ENABLED, STD,"Save All", SavingAllFiles,
  321.         PXL_PRINT,  ENABLED, STD,"PrintFile", PrintingFile,
  322.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  323.         HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp)
  324.         Endif
  325.  
  326.  
  327.         SetMenu("&File",IGNORE,
  328.             "&New",CreatingFile,
  329.             "&Open",OpeningFile,
  330.             "&Save",SavingFile,
  331.             "&Print",PrintingFile,
  332.             SEPARATOR,
  333.             "E&xit!",Terminate,
  334.             ENDPOPUP,
  335.             "&View",IGNORE,
  336.             "&ToolBar",ViewToolBar,
  337.             "&StatusBar",ViewStatusBar,
  338.             ENDPOPUP, 
  339.             "&Information",IGNORE,
  340.             "&Concept",Concept,
  341.             "&Help",ShowAppHelp,
  342.             SEPARATOR,
  343.             "&About",About,
  344.             ENDPOPUP)
  345.  
  346.  
  347.     Endif
  348.  
  349.     If Res = 2 Then Goto Leave
  350.  
  351.  
  352.     If Audio = 1 Then WAVPlaySound("step6.wav",ASYNC,FILENAME,Res)
  353.     MessageBox(YESNOCANCEL,1,QUESTION,
  354. "Do you want to be able to drop load files into your program ?
  355.  
  356. Click Yes to enable DragAccept File operation.
  357.  
  358. Click No to continue.
  359.  
  360. Click Cancel to terminate this Helper App.",
  361.     "Step #6: Setting Drag and Drop options",Res)
  362.  
  363.     If Res = 3  Then Goto Leave
  364.  
  365.     If Res = 1 Then FileDragAccept = 1
  366.  
  367.     ShowAutoProgressBar = 0
  368.  
  369.     If Audio = 1 Then WAVPlaySound("step7.wav",ASYNC,FILENAME,Res)
  370.     MessageBox(YESNOCANCEL,1,QUESTION,
  371. "Do you want to disable the automatic progress bar display
  372. on image loading and processing operations ?
  373.  
  374. Click Yes to disable the AutoProgressBar display.
  375.  
  376. Click No to continue.
  377.  
  378. Click Cancel to terminate this Helper App.",
  379.     "Step #7: Setting AutoProgressBar option",Res)
  380.  
  381.     If Res = 3  Then Goto Leave
  382.  
  383.     If Res = 1 Then ShowAutoProgressBar = 1
  384.  
  385.     If Audio = 1 Then WAVPlaySound("step8.wav",ASYNC,FILENAME,Res)
  386.     MessageBox(YESNOCANCEL,1,QUESTION,
  387. "New program definition is now complete.  Are you ready to save the 
  388. program skeleton code ?
  389.  
  390. Click Yes to create the new program and write it to your disk.
  391.  
  392. Click No to respecifiy.
  393.  
  394. Click Cancel to terminate this Helper App.",
  395.     "Step #8: Creating the new program",Res)
  396.  
  397.     If Res = 1 Then Step = 8 Goto Terminate
  398.     If Res = 2 Then Goto StartCreateCode
  399.     If Res = 3 Then Goto Leave
  400.  
  401. CreatingFile:
  402. OpeningFile:
  403. SavingFile:
  404. SavingAllFiles:
  405. PrintingFile:
  406. ViewToolBar:
  407. ViewStatusBar:
  408. Concept:
  409. About:
  410.     Goto Wait_for_Input
  411.  
  412. AddDialogCode:
  413.     SetMouse()
  414.     GoSub SetUpCodeFragments
  415.  
  416.     List$ = "FileGet|FileSave|ChooseColor|ChooseFont|TextBox|ListBox|"
  417.     DialogBox(15,10,155,260,"Create dialogbox code",CAP_NCTR, 5,5,22,22,ICON11,
  418.              105, 8,138,23,"&Test",26, Res,       {0 = test dialog}
  419.              105,28,138,43,BTN,PUSH,"&Copy",      {1 = OK}
  420.              105,48,138,63,BTN,PUSH,"&Cancel", {2 = Cancel}
  421.              105,78,138,93,BTN,PUSH,"&Help",      {3 = Help}
  422.              105,108,138,123,BTN,PUSH,"&Test",  {4 = Test}
  423.  
  424.              20,0,101,80,BTN,GROUP,"Common Dialogs",
  425.              25,10,100,18,BTN,AUTORADIO,"FileGet dialog",State1,
  426.              25,20,100,28,BTN,AUTORADIO,"FileSave dialog",State2,
  427.              25,30,100,38,BTN,AUTORADIO,"ChooseColor STD",State3,
  428.              25,40,100,48,BTN,AUTORADIO,"ChooseColor FULL",State4,
  429.              25,50,100,58,BTN,AUTORADIO,"ChooseFont dialog",State5,
  430.              25,60,100,68,BTN,AUTORADIO,"Print Setup dialog",State6,
  431.              25,70,100,78,BTN,AUTORADIO,"Print Page dialog",State7,
  432.  
  433.              20,85,101,155,BTN,GROUP,"Some Custom Dialogs",
  434.              25,95,100,103,BTN,AUTORADIO,"Number dialog",State15,
  435.              25,105,100,113,BTN,AUTORADIO,"Coordinate dialog",State16,
  436.              25,115,100,123,BTN,AUTORADIO,"RGB triplet dialog",State17,             
  437.              25,125,100,133,BTN,AUTORADIO,"Rect quad dialog",State18,             
  438.              25,135,100,143,BTN,AUTORADIO,"Listing dialog",State19,
  439.              25,145,100,153,BTN,AUTORADIO,"UserIDPassword",State20,
  440.  
  441.              20,160,101,230,BTN,GROUP,"Built-in Dialogs",
  442.              25,170,100,178,BTN,AUTORADIO,"MessageBox",State21,
  443.              25,180,100,188,BTN,AUTORADIO,"TextBox",State22,
  444.              25,190,100,198,BTN,AUTORADIO,"ListBox",State23,
  445.              25,200,100,208,BTN,AUTORADIO,"ImageBox",State24,
  446.              25,210,100,218,BTN,AUTORADIO,"MonthCalControl",State25,
  447.              25,220,100,228,BTN,AUTORADIO,"IPAddressBox",State26)
  448.  
  449.              
  450.     
  451.     If Res = 4 Then Res = 0
  452.  
  453.     If Res = 0 { we want to test the dialog, new Res is returned}
  454.         If State1 = 1 Then GoSub TestFileGetCode
  455.         If State2 = 1 Then GoSub TestFileSaveAsCode
  456.         If State3 = 1 Then GoSub TestChooseColorCode1
  457.         If State4 = 1 Then GoSub TestChooseColorCode2
  458.         If State5 = 1 Then GoSub TestChooseFontCode
  459.         If State6 = 1 Then GoSub TestPrintSetupCode
  460.         If State7 = 1 Then GoSub TestPrintPageCode
  461.  
  462.         Fdx1 = 30 Fdy1 = 30
  463.         If State15 = 1 Then FunctionDialogTitle$ = "Enter a number" GoSub ShowFunctionDialog1
  464.         If State16 = 1 Then FunctionDialogTitle$ = "Enter a coordinate" GoSub ShowFunctionDialog2
  465.         If State17 = 1 Then FunctionDialogTitle$ = "Enter an RGB triplet" GoSub ShowFunctionDialog3
  466.         If State18 = 1 Then FunctionDialogTitle$ = "Enter a Coordinate quad" GoSub ShowFunctionDialog4
  467.         If State19 = 1 Then GoSub ShowListingControl 
  468.         If State20 = 1 Then GoSub ShowUserIDPassword
  469.  
  470.         If State21 = 1 Then GoSub ShowMessageBox
  471.         If State22 = 1 Then GoSub ShowTextBox
  472.         If State23 = 1 Then GoSub ShowListBox
  473.         If State24 = 1 Then GoSub ShowImageBox
  474.         If State25 = 1 Then GoSub ShowMonthCalControl
  475.         If State26 = 1 Then GoSub ShowIPAddressBox
  476.     Endif
  477.     
  478.     If Res = 0 Then Goto AddDialogCode
  479.  
  480.     If Res = 1 { copy the code to the clipboard}
  481.         ClipboardEmpty
  482.         If State1 = 1 Then ClipboardPut(FileGetCode$,Res) State1 = 0
  483.         If State2 = 1 Then ClipboardPut(FileSaveAsCode$,Res) State2 = 0
  484.         If State3 = 1 Then ClipboardPut(ChooseColorCode1$,Res) State3 = 0
  485.         If State4 = 1 Then ClipboardPut(ChooseColorCode2$,Res) State4 = 0
  486.         If State5 = 1 Then ClipboardPut(ChooseFontCode$,Res) State5 = 0
  487.         If State6 = 1 Then ClipboardPut(PrintSetupCode$,Res) State6 = 0
  488.         If State7 = 1 Then ClipboardPut(PrintPageCode$,Res) State7 = 0
  489.  
  490.         If State15 = 1 Then ClipboardPut(FunctionDialog1Code$,Res) State15 = 0
  491.         If State16 = 1 Then ClipboardPut(FunctionDialog2Code$,Res) State16 = 0
  492.         If State17 = 1 Then ClipboardPut(FunctionDialog3Code$,Res) State17 = 0
  493.         If State18 = 1 Then ClipboardPut(FunctionDialog4Code$,Res) State18 = 0
  494.         If State19 = 1 Then ClipboardPut(ListingControlCode$,Res) State19 = 0
  495.         If State20 = 1 Then ClipboardPut(UserIDPasswordCode$,Res) State20 = 0
  496.  
  497.         If State21 = 1 Then ClipboardPut(MessageBoxCode$,Res) State21 = 0
  498.         If State22 = 1 Then ClipboardPut(TextBoxCode$,Res) State22 = 0 
  499.         If State23 = 1 Then ClipboardPut(ListBoxCode$,Res) State23 = 0 
  500.         If State24 = 1 Then ClipboardPut(ImageBoxCode$,Res) State24 = 0
  501.         If State25 = 1 Then ClipboardPut(MonthCalControlCode$,Res) State25 = 0 
  502.         If State26 = 1 Then ClipboardPut(IPAddressBoxCode$,Res) State26 = 0
  503.     Endif
  504.  
  505.     If Res = 3
  506.         Gosub ShowAppHelpMsgBox
  507.     Endif
  508.     If Res = 3 Then Goto AddDialogCode
  509.  
  510.     Goto Wait_for_Input
  511.  
  512.  
  513. GetWorkingDirectory: {Subroutine; Check in the Registry for the WorkingDir$
  514.     from HKEY_CURRENT_USER\Software\VYSOR Integration Inc\PiXCL MDI Editor\Settings\CurDir
  515.     Note here how we can specify the complete registry path. Also, we retrieve the correct
  516.     SourceDir$ path for the base code file by getting the path of this helper app, then 
  517.     stripping the path. }
  518.  
  519.     RDBOpenKey(@RDB_CURRENT_USER,
  520.         "Software\VYSOR Integration Inc\PiXCL MDI Editor\Settings",OutHandle1)
  521.     RDBQueryValue(OutHandle1,"CurDir",WorkingDir$,Res)
  522.     RDBQueryValue(OutHandle1,"Helper_2_Path",SourceDir$,Res)
  523.     Lcase(SourceDir$)
  524.     Instr(SourceDir$,"\cre8tapp.exe",Loc)
  525.     LeftOf(SourceDir$,Loc,SourceDir$)
  526. {
  527.     {display debug messages if desired}
  528.     MessageBox(OK,1,INFORMATION,SourceDir$,"SourceDir$",Res)
  529.     MessageBox(OK,1,INFORMATION,WorkingDir$,"Current Working Directory",Res)
  530. }
  531.     RDBCloseKey(OutHandle1,Res)
  532.     Return
  533.  
  534.  
  535.  
  536.  
  537.  
  538. AdjustStandardCode: {Subroutine: adjust the script contents in Code$ with a series of StrRepl }
  539.  
  540. {Set the new filename, date, title for main window and about box: AppTitle$}
  541.  
  542.     FileName(NewCodeFile$,NewName$,Res)
  543.     NewName$ = NewName$ + ".pxl"
  544.     StrRepl(Code$,"user1_12.pxl",NewName$,Res)
  545.     StrRepl(Code$,"PiXCL Skeleton Application",AppTitle$,Res)
  546.     StrRepl(Code$,"User Application Title goes here",AppTitle$,Res)
  547.     TimeToASCII(LOCAL,MDDYYYY,TimeString$)
  548.     StrRepl(Code$,"<date>",TimeString$,Res)
  549.     StrRepl(Code$,"<author>",Author$,Res)
  550.     StrRepl(Code$,"<Skeleton file for PiXCL applications>",Purpose$,Res)
  551.  
  552. {Set the default dimensions in WinLocate: app_x1,app_y1,app_x2,app_y2}
  553.     Str(app_x1,app_x1$)
  554.     Str(app_y1,app_y1$)
  555.     Str(app_x2,app_x2$)
  556.     Str(app_y2,app_y2$)
  557.     NewString$ = "(Title$," +  app_x1$
  558.     NewString$ = NewString$ + ","
  559.     NewString$ = NewString$ + app_y1$
  560.     NewString$ = NewString$ + ","
  561.     NewString$ = NewString$ + app_x2$
  562.     NewString$ = NewString$ + ","
  563.     NewString$ = NewString$ + app_y2$
  564.     NewString$ = NewString$ + ",Res)"
  565.  
  566.     StrRepl(Code$,"(Title$,100,200,588,420,Res)",NewString$,Res)
  567.     FreeVar(NewString$)
  568.  
  569. {Set the background color}
  570.     Str(Red,Red$)
  571.     Str(Green,Green$)
  572.     Str(Blue,Blue$)
  573.     NewString$ = "TRANSPARENT," + Red$
  574.     NewString$ = NewString$ + ","
  575.     NewString$ = NewString$ + Green$
  576.     NewString$ = NewString$ + ","
  577.     NewString$ = NewString$ + Blue$
  578.  
  579.     StrRepl(Code$,"TRANSPARENT,255,255,255",NewString$,Res)
  580.  
  581. {Enable the toolbar}
  582.     Chr(34,Quote$)
  583.     If UseToolBar = 1
  584.             StrRepl(Code$,"{GoSub MakeToolbar","GoSub MakeToolbar",Res)
  585.             StrRepl(Code$,"CHECK,TBRes) }","CHECK,TBRes)",Res)
  586.             StrRepl(Code$,"AppHelp)}","AppHelp)",Res)
  587.             String1$ = "{" + Quote$
  588.             String1$ = String1$ + "&View"
  589.             RightOf(String1$,1,String2$ )
  590.             StrRepl(Code$,String1$,String2$,Res)
  591.             StrRepl(Code$,"ENDPOPUP, }","ENDPOPUP,",Res)
  592.  
  593.            {set the toolbar style, with ToolSize[1-4] }
  594.            If ToolSize2 = 1 Then StrRepl(Code$,"RAISED, PXL_SMALL","FLAT, PXL_SMALL",Res)
  595.            If ToolSize3 = 1 Then StrRepl(Code$,"RAISED, PXL_SMALL","RAISED, PXL_LARGE",Res)
  596.            If ToolSize4 = 1 Then StrRepl(Code$,"RAISED, PXL_SMALL","FLAT, PXL_LARGE",Res)
  597.     Endif
  598.  
  599.  
  600. {Enable the StatusBar: Field[1-4]$ are relevent to create the new command that replaces
  601.  
  602.     {StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0) }
  603. }
  604.  
  605.     Chr(9,TAB$) Chr(10,LF$) 
  606.     LF$ = LF$  + TAB$   LF$ = LF$ + TAB$
  607.     If UseStatusBar = 1
  608.             SWCmd$ = Panes$ + ","
  609.             SWCmd$ = SWCmd$ + xField1$
  610.             SWCmd$  = SWCmd$ + ","
  611.             SWCmd$  = SWCmd$ + xField2$
  612.             SWCmd$  = SWCmd$ + ","
  613.             SWCmd$  = SWCmd$ + xField3$
  614.             SWCmd$  = SWCmd$ + ","
  615.             SWCmd$  = SWCmd$ + xField4$
  616.             SWCmd$  = SWCmd$ + ")"
  617.             StrRepl(Code$,"{StatusWindow","StatusWindow",Res)
  618.             StrRepl(Code$,"2,200,-1,0,0)",SWCmd$,Res) {initial}
  619.             StrRepl(Code$,"2,200,-1,0,0)",SWCmd$,Res) {view enable statusbar}
  620.             StrRepl(Code$,"2,200,-1,0,0)",SWCmd$,Res) {view disable statusbar}
  621.             StrRepl(Code$,"CHECK,SBRes)  }","CHECK,SBRes)",Res)
  622.     Else
  623.             String1$ = Quote$ + "&StatusBar"
  624.             String1$ = String1$ + Quote$
  625.             String1$ = String1$ + ",ViewStatusBar,"
  626.             String1$ = String1$ + LF$
  627.             StrRepl(Code$,String1$,"",Res)
  628.     Endif
  629.  
  630. {Enable drag and drop}
  631.     If FileDragAccept = 1
  632.             StrRepl(Code$,"{DragAcceptFile","DragAcceptFile",Res)
  633.             StrRepl(Code$,"AcceptFile)}","AcceptFile)",Res)
  634.     Endif
  635.  
  636. {Disable AutoProgressBar ?}
  637.     If ShowAutoProgressBar = 1
  638.             StrRepl(Code$,"{AutoProgressBar(DISABLE)}","AutoProgressBar(DISABLE)",Res)
  639.     Endif
  640.  
  641.  
  642. {Adjust the Helpfile name with NewCodeFile$}
  643.     FileName(NewCodeFile$,AppName$,Res)
  644.     AppName$ = AppName$ + ".hlp"
  645.     StrRepl(Code$,"MyApp.hlp",AppName$,Res)
  646.  
  647.     Return
  648.  
  649. SetFontColor: {subroutine: set a font color that contrasts with the background}
  650.     Color = 0
  651.     If Red < 128 Then Color = 255
  652.     If Green < 128 Then Color = 255
  653.     If Blue < 128 Then Color = 255
  654.     UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,Color,Color,Color)
  655.     Return
  656.  
  657. ShowAppHelpMsgBox: {subroutine}
  658.     HelpMsg$ = 
  659. "This Helper application has two functions:
  660.         -- Making New Applications --
  661. It asks a number of questions about your new PiXCL program, 
  662. then creates an application code skeleton that is copied into a 
  663. new PiXCL MDI Editor document using drag and drop.
  664.  
  665. The details that you set will be reflected in the appearance of the 
  666. Helper App window.
  667.  
  668. The code produced is a complete running application, however,
  669. this Helper will not write your whole program:  you will need 
  670. to add various specific processing codes, and customise menu, 
  671. toolbar, toolwindow and controls. 
  672.  
  673.         -- Updating Existing Applications --
  674. It also provides code fragments for the common dialogs, 
  675. plus a selection of often used custom dialogs. You can test the 
  676. dialog before inserting it into your existing application. Clicking the 
  677. test dialog ''Cancel'' button does nothing: clicking the ''OK'' or 
  678. equivalent button writes the code fragment to the clipboard, and
  679. a right click or Ctrl-V in the MDI editor pastes the code into your 
  680. application source document.  Some additional editting is then 
  681. required.
  682.  
  683. If you want to extend this Helper, see the PiXCL sample directory 
  684. source file
  685.  
  686.           'cre8tapp.pxl'.
  687.  
  688. Edit the beginning of this code to disable the audio instructions."
  689.     Sample$ = SourceDir$ + "\cre8tapp.pxl"
  690.     StrRepl(HelpMsg$,"'cre8tapp.pxl'",Sample$,Rsx)
  691.     
  692.     {Note how the dir pointer is customised to your installation}
  693.     {MessageBox(OK,1,ICON12,HelpMsg$,"Code Writer Helper Application",Rsx)}
  694.  
  695.     DialogBox(15,5,265,282,"Code Writer Helper Application",CAP_NCTR,12,12,32,32,ICON12,
  696.               95,260,155,272,"&OK",1,Rsx, {returns 0}
  697.                35,5,260,258,STATIC,LEFT,HelpMsg$)
  698.  
  699.  
  700.     Return
  701.  
  702. SetUpCodeFragments:
  703.     Chr(9,tab$) Chr(10,cr$) Chr(34,qt$)
  704.     FileGetCode$ = tab$ + "Filter$ = " + qt$ + "All Files (*.*),*.*" + qt$ + cr$ +
  705.             tab$ + "Label$ = " + qt$ + "Select a file to open" + qt$ + cr$ +
  706.                      tab$ + "InitFile$ = " + qt$ + "*.*" + qt$ + cr$ + 
  707.                      tab$ + "InitDir$ = SourceDir$" + cr$ +
  708.             tab$ + "FileGet(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,ChosenFile$)" + cr$
  709.  
  710.     FileSaveAsCode$ = tab$ + "Filter$ = " + qt$ + "All Files (*.*),*.*" + qt$ + cr$ +
  711.             tab$ + "Label$ = " + qt$ + "Select a file to save" + qt$ + cr$ +
  712.                      tab$ + "InitFile$ = " + qt$ + "*.*" + qt$ + cr$ + 
  713.                      tab$ + "InitDir$ = SourceDir$" + cr$ +
  714.             tab$ + "FileSaveAs(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,ChosenFile$)" + cr$
  715.  
  716.  
  717.     ChooseColorCode1$ = tab$ + "DlgTitle$ = " + qt$ + qt$ + "{fill in title}"+ cr$ + 
  718.             tab$ + "Basic$ = " + qt$ + qt$ + "{fill in string}"+cr$ +
  719.             tab$ + "Custom$ = " + qt$ + qt$ + "{fill in string}"+cr$ +
  720.             tab$ + "ChooseColor(STD,Red,Green,Blue,X,Y,DlgTitle$,Basic$,Custom$)"
  721.  
  722.     ChooseColorCode2$ = tab$ + "DlgTitle$ = " + qt$ + qt$ + "{fill in title}"+ cr$ + 
  723.             tab$ + "Basic$ = " + qt$ + qt$ + "{fill in string}"+cr$ +
  724.             tab$ + "Custom$ = " + qt$ + qt$ + "{fill in string}"+cr$ +
  725.             tab$ + "ChooseColor(FULL,Red,Green,Blue,X,Y,DlgTitle$,Basic$,Custom$)"
  726.  
  727.  
  728.     ChooseFontCode$ = tab$ + "ChooseFont(Font$,Width,Height,r,g,b,Bold,Italic,Underline,Strikeout)" + cr$
  729.     UseFontExCode$ = tab$ + "UseFontExt(Font$,Width,Height,Bold,Italic,Underline,Strikeout,r,g,b)" + cr$
  730.     UseFontCode$ = tab$ + "UseFont(Font$,Width,Height,NOBOLD,NOITALIC,NOUNDERLINE,r,g,b)" + cr$
  731.  
  732.  
  733.     PrintSetupCode$ = tab$ + "PrintBitmap(FileName$,SETUP, Result) {edit as necessary}" + cr$
  734.  
  735.     PrintPageCode$ = tab$ + "PrintBitmap(FileName$,PRINT_PAGERES, Result) {edit as necessary}" + cr$
  736.  
  737.  
  738.     FunctionDialog1Code$ = "Fdx1 = <x>  Fdy1 = <y> {set the X,Y coordinates} " + cr$ +
  739.         tab$ + "FunctionDialogTitle$ = " + qt$ + "<dialog title>" + qt$ + cr$ + 
  740.         tab$ + "GoSub ShowFunctionDialog1" + cr$ + cr$ + 
  741.         "{Move this subroutine to a suitable location, or delete it if already inserted}" + cr$ + 
  742.         "ShowFunctionDialog1: {subroutine: one numeric input }" + cr$ + 
  743.         tab$ + "Fdx2 = Fdx1 + 150" + cr$ +
  744.         tab$ + "Fdy2 = Fdy1 + 50" + cr$ + 
  745.         tab$ + "DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR," + cr$ + 
  746.         tab$ + tab$ + "5,15,24,24,QUESTION," + cr$ + 
  747.         tab$ + tab$ + "110,25,145,40," + qt$ + "&Cancel" + qt$ + ",4,FDRes,  {returns 0}" + cr$ + 
  748.         tab$ + tab$ + "48,17,100,27,STATIC,LEFT," + qt$ + "Input value" + qt$ + ", {edit string}" + cr$ + 
  749.         tab$ + tab$ + "20,5,105,45,BTN,GROUP," + qt$ + "Numeric Input" + qt$ + ", {edit string}" + cr$ + 
  750.         tab$ + tab$ + "25,17,45,27,EDIT,NUMBER,InputValue$,InputValue$," + cr$ + 
  751.         tab$ + tab$ + "110,5,145,20,BTN,PUSH," + qt$ + "&OK" + qt$ + ")  {returns 1}" + cr$ + 
  752.         tab$ + "Return" + cr$
  753.  
  754.     FunctionDialog2Code$ = "Fdx1 = <x>  Fdy1 = <y> {set the X,Y coordinates}" + cr$ +
  755.         tab$ + "FunctionDialogTitle$ = " + qt$ + "<dialog title>" + qt$ + cr$ + 
  756.         tab$ + "GoSub ShowFunctionDialog2" + cr$ + cr$ + 
  757.         "{Move this subroutine to a suitable location, or delete it if already inserted}" + cr$ + 
  758.         "ShowFunctionDialog2: {subroutine: two numeric inputs}"+ cr$ + 
  759.         tab$ + "Fdx2 = Fdx1 + 150" + cr$ +
  760.         tab$ + "Fdy2 = Fdy1 + 50" + cr$ + 
  761.         tab$ + "DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR, "+ cr$ + 
  762.         tab$ + tab$ + "5,15,24,24,QUESTION," + cr$ + 
  763.         tab$ + tab$ + "110,25,145,40," + qt$ + "&Cancel" + qt$ + ",6,FDRes,  {returns 0}"+ cr$ + 
  764.         tab$ + tab$ + "48,17,100,27,STATIC,LEFT," + qt$ + "High range value"+ qt$ + ", {edit string}"+ cr$ + 
  765.         tab$ + tab$ + "48,29,100,39,STATIC,LEFT," + qt$ + "Low range value"+ qt$ + ", {edit string}"+ cr$ + 
  766.         tab$ + tab$ + "20,5,105,45,BTN,GROUP," + qt$ + "Numeric Input"+ qt$ + ", {edit string}"+ cr$ + 
  767.         tab$ + tab$ + "25,17,45,27,EDIT,NUMBER,HiRange$,HiRange$,"+ cr$ + 
  768.         tab$ + tab$ + "25,29,45,39,EDIT,NUMBER,LoRange$,LoRange$, "+ cr$ + 
  769.         tab$ + tab$ + "110,5,145,20,BTN,PUSH," + qt$ +"&OK"+ qt$ +")  {returns 1}"+ cr$ + 
  770.         tab$ + "Return" + cr$
  771.  
  772.  
  773.  
  774.     FunctionDialog3Code$ =  "Fdx1 = <x>  Fdy1 = <y> {set the X,Y coordinates}" + cr$ +
  775.         tab$ + "FunctionDialogTitle$ = " + qt$ + "<dialog title>" + qt$ + cr$ + 
  776.         tab$ + "GoSub ShowFunctionDialog3" + cr$ + cr$ + 
  777.         "{Move this subroutine to a suitable location, or delete it if already inserted}" + cr$ + 
  778.         "ShowFunctionDialog3: {subroutine: three numeric inputs}" + cr$ +
  779.         tab$ + "Fdx2 = Fdx1 + 150" + cr$ +
  780.         tab$ + "Fdy2 = Fdy1 + 65" + cr$ + 
  781.         tab$ + "DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,"+ cr$ + 
  782.         tab$ + tab$ + "5,15,24,24,QUESTION,"+ cr$ + 
  783.         tab$ + tab$ + "110,35,145,50," + qt$ + "&Cancel" + qt$ + ",8,FDRes,  {returns 0}"+ cr$ + 
  784.         tab$ + tab$ + "48,17,100,27,STATIC,LEFT," + qt$ + "High range value" + qt$ + " , {edit string}"+ cr$ + 
  785.         tab$ + tab$ + "48,29,100,39,STATIC,LEFT," + qt$ + "Mid range value" + qt$ + " , {edit string}"+ cr$ + 
  786.         tab$ + tab$ + "48,41,100,51,STATIC,LEFT," + qt$ + "Low range value" + qt$ + " , {edit string}"+ cr$ + 
  787.         tab$ + tab$ + "20,5,105,55,BTN,GROUP," + qt$ + "Numeric Input" + qt$ + " , {edit string}"+ cr$ + 
  788.         tab$ + tab$ + "25,17,45,27,EDIT,NUMBER,HiRange$,HiRange$,"+ cr$ + 
  789.         tab$ + tab$ + "25,29,45,39,EDIT,NUMBER,MidRange$,MidRange$,"+ cr$ + 
  790.         tab$ + tab$ + "25,41,45,51,EDIT,NUMBER,LoRange$,LoRange$,"+ cr$ + 
  791.         tab$ + tab$ + "110,15,145,30,BTN,PUSH," + qt$ + "&OK" + qt$ + ")  {returns 1}"+ cr$ + 
  792.         tab$ + "Return"+ cr$
  793.  
  794.  
  795.     FunctionDialog4Code$ = "Fdx1 = <x>  Fdy1 = <y> {set the X,Y coordinates}" + cr$ +
  796.         tab$ + "FunctionDialogTitle$ = " + qt$ + "<dialog title>" + qt$ + cr$ + 
  797.         tab$ + "GoSub ShowFunctionDialog4" + cr$ + cr$ + 
  798.         "{Move this subroutine to a suitable location, or delete it if already inserted}" + cr$ + 
  799.         "ShowFunctionDialog4: {subroutine: four numeric inputs}" + cr$ +
  800.         tab$ + "Fdx2 = Fdx1 + 150" + cr$ +
  801.         tab$ + "Fdy2 = Fdy1 + 75" + cr$ + 
  802.         tab$ + "DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,"+ cr$ + 
  803.         tab$ + tab$ + "5,15,24,24,QUESTION,"+ cr$ + 
  804.         tab$ + tab$ + "110,35,145,50," + qt$ + "&Cancel" + qt$ + ",10,FDRes,  {returns 0}"+ cr$ + 
  805.         tab$ + tab$ + "48,17,100,27,STATIC,LEFT," + qt$ + "X1 value" + qt$ + " , {edit string}"+ cr$ + 
  806.         tab$ + tab$ + "48,29,100,39,STATIC,LEFT," + qt$ + "Y1 value" + qt$ + " , {edit string}"+ cr$ + 
  807.         tab$ + tab$ + "48,41,100,51,STATIC,LEFT," + qt$ + "X2 value" + qt$ + " , {edit string}"+ cr$ + 
  808.         tab$ + tab$ + "48,53,100,63,STATIC,LEFT," + qt$ + "Y2 value" + qt$ + " , {edit string}"+ cr$ + 
  809.         tab$ + tab$ + "20,5,105,67,BTN,GROUP," + qt$ + "Rectangle Coord Input" + qt$ + " , {edit string}"+ cr$ + 
  810.         tab$ + tab$ + "25,17,45,27,EDIT,NUMBER,rX1$,rX1$,"+ cr$ + 
  811.         tab$ + tab$ + "25,29,45,39,EDIT,NUMBER,rY1$,rY1$,"+ cr$ + 
  812.         tab$ + tab$ + "25,41,45,51,EDIT,NUMBER,rX2$,rX2$,"+ cr$ + 
  813.         tab$ + tab$ + "25,53,45,63,EDIT,NUMBER,rY2$,rY2$,"+ cr$ + 
  814.         tab$ + tab$ + "110,15,145,30,BTN,PUSH," + qt$ + "&OK" + qt$ + ")  {returns 1}"+ cr$ + 
  815.         tab$ + "Return"+ cr$
  816.  
  817.  
  818.  
  819.     ListingControlCode$ = tab$ + "Fdx1 = <x>  Fdy1 = <y> {set the X,Y coordinates}" + cr$ +
  820.         tab$ + "GoSub ShowListingControl" + cr$ + cr$ + 
  821.         "{Move this subroutine to a suitable location, or delete it if already inserted}" + cr$ + 
  822.         "ShowListingControl: {subroutine}" + cr$ + 
  823.         tab$ + "Fdx2 = Fdx1 + 210" + cr$ + 
  824.         tab$ + "Fdy2 = Fdy1 + 160" + cr$ + 
  825.         tab$ + "Msg$ = " + qt$ + "Fill this string with the initial text, eg with FileRead_ASCII" + qt$ + cr$ + 
  826.         tab$ + "DialogBox(Fdx1,Fdy1,Fdx2,Fdy2," + qt$ + "Edit Control Dialog Box" + qt$ + ", CAP_NCTR, " + cr$ + 
  827.         tab$ + tab$ + "15,25, 48,48, ICON01, " + cr$ + 
  828.         tab$ + tab$ + "30,145,80,158," + qt$ + "&Cancel" + qt$ + ", 2, Res," + cr$ + 
  829.         tab$ + tab$ + "130,145,180,158,BTN, PUSH," + qt$ +"&OK,"  + qt$  + cr$ + 
  830.         tab$ + tab$ + "  5,5,205,143,EDIT,MLSTRING,Msg$,Res2$)" + cr$ + 
  831.         tab$ + "Return" + cr$
  832.  
  833.  
  834.     UserIDPasswordCode$ = tab$ + "Fdx1 = <x>  Fdy1 = <y> {set the X,Y coordinates}" + cr$ +
  835.         tab$ + "GoSub ShowUserIDPassword" + cr$ + cr$ + 
  836.         "{Move this subroutine to a suitable location, or delete it if already inserted}" + cr$ + 
  837.         "ShowUserIDPassword: {subroutine}" + cr$ + 
  838.         tab$ + "Fdx2 = Fdx1 + 230" + cr$ + 
  839.         tab$ + "Fdy2 = Fdy1 + 90" + cr$ + 
  840.         tab$ + "Msg$ = " + qt$ + "Please enter your UserID and Password" + qt$  + cr$ + 
  841.         tab$ + "Info$ = " + qt$ + "Information" + qt$ +  cr$ + 
  842.         tab$ + "MoreInfo$ = " + qt$ + "<insert desired instruction string>" + qt$  + cr$ + 
  843.         tab$ + "DialogBox(Fdx1,Fdy1,Fdx2,Fdy2," + qt$ + "UserID and Password Entry" + qt$ + ", CAP_NCTR," + cr$ + 
  844.         tab$ + tab$ + "350,110, 64,64, WINLOGO, " + cr$  + 
  845.         tab$ + tab$ + "170,15,220,30," + qt$ + "&Cancel" + qt$ + ",   6,   Res, {returns 0}" + cr$ + 
  846.         tab$ + tab$ + "170,35,220,50,BTN,PUSH," + qt$ + "&OK" + qt$  + ", {returns 1}" + cr$ + 
  847.         tab$ + tab$ + "25,2,165,18,STATIC, LEFT, Msg$ ," + cr$ + 
  848.         tab$ + tab$ + " 4,17,160,30,EDIT,STRING," + qt$ + qt$ + ",UserID$," + cr$ + 
  849.         tab$ + tab$ + " 4,37,160,50,EDIT,PASSWORD," + qt$ + qt$ + ",Pwd$," + cr$ + 
  850.         tab$ + tab$ + " 4,52,160,88,BTN,GROUP,Info$," + cr$ + 
  851.         tab$ + tab$ + " 6,60,158,87,STATIC,LEFT,MoreInfo$)" + cr$ + 
  852.         tab$ + "Return" + cr$ 
  853.  
  854.     MessageBoxCode$ = tab$ + "MessageBox(OKCANCEL,1,ICON01,Msg$,MsgBoxTitle$,Res)" + cr$
  855.  
  856.     TextBoxCode$ = tab$ + "TextBox(Text$,Caption$,Input$,ButtonPushed)" + cr$
  857.  
  858.     ListBoxCode$ = tab$ + "ListBox(Caption$,List$,Delimiter$,Result$)"+ cr$
  859.  
  860.     ImageBoxCode$ = tab$ + "Title$,ImageFile$,Text$,Btn1_Label$,Btn2_Label$,Btn)" + cr$
  861.  
  862.     MonthCalControlCode$ = tab$ + "MonthCalControl(X,Y, Title$, MonthDelta, TODAY, " 
  863.                      + "MOVE, TODAYCIRCLE, WEEKNUMBERS, WDMDDYYYY, " 
  864.                      + "TimeString$, Result)" + cr$
  865.  
  866.     IPAddressBoxCode$ = tab$ + "IPAddressBox(x1,y1,x2,y2,Result)" + cr$
  867.  
  868.     Return
  869.  
  870.  
  871. TestFileGetCode:
  872.     Filter$ = "All Files (*.*),*,*" 
  873.     Label$ = "Select a file to open"
  874.     InitFile$ =  "*.*" 
  875.     InitDir$ = SourceDir$
  876.     FileGet(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,ChosenFile$)
  877.     Res = 1    
  878.     If ChosenFile$ = "" Then Res = 0
  879.         
  880.     Return
  881.  
  882. TestFileSaveAsCode:
  883.     Filter$ = "All Files (*.*),*,*" 
  884.     Label$ = "Select a file to save"
  885.     InitFile$ =  "*.*" 
  886.     InitDir$ = SourceDir$
  887.     FileSaveAs(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,ChosenFile$)
  888.     Res = 1    
  889.     If ChosenFile$ = "" Then Res = 0
  890.     Return
  891.  
  892. TestChooseColorCode1:
  893.     Basic$ = "" {fill in string}
  894.     Custom$ = "" {fill in string}
  895.     ChooseColor(STD,Red,Green,Blue,X,Y,DlgTitle$,Basic$,Custom$)
  896.     Res = 1
  897.     If Red = -1 Then Res = 0
  898.     Return
  899.  
  900. TestChooseColorCode2:
  901.     Basic$ = "" {fill in string}
  902.     Custom$ = "" {fill in string}
  903.     ChooseColor(FULL,Red,Green,Blue,X,Y,DlgTitle$,Basic$,Custom$)
  904.     Res = 1
  905.     If Red = -1 Then Res = 0
  906.     Return
  907.  
  908. TestChooseFontCode:
  909.     ChooseFont(Font$,Width,Height,r,g,b,Bold,Italic,Underline,Strikeout)
  910.     Res = 1
  911.     If Font$ = "" Then Res = 0
  912.     Return
  913.  
  914. TestPrintSetupCode:
  915.     PrintBitmap(FileName$,SETUP, Result) 
  916.     Return
  917.  
  918. TestPrintPageCode:
  919.     PrintBitmap(FileName$,PRINT_PAGERES, Result)
  920.     Return
  921.  
  922. ShowFunctionDialog1: {subroutine: one numeric input }
  923.     Fdx2 = Fdx1 + 150
  924.     Fdy2 = Fdy1 + 50
  925.     DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,
  926.         5,15,24,24,QUESTION,
  927.         110,25,145,40,"&Cancel",4,Res,  {returns 0}
  928.         48,17,100,27,STATIC,LEFT,"Input value", {edit string}
  929.         20,5,105,45,BTN,GROUP,"Numeric Input", {edit string}
  930.         25,17,45,27,EDIT,NUMBER,InputValue$,InputValue$,
  931.         110,5,145,20,BTN,PUSH,"&OK")  {returns 1}
  932.     Return
  933.  
  934.  
  935. ShowFunctionDialog2: {subroutine: two numeric inputs}
  936.     Fdx2 = Fdx1 + 150
  937.     Fdy2 = Fdy1 + 50
  938.     DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,
  939.         5,15,24,24,QUESTION,
  940.         110,25,145,40,"&Cancel",6,Res,  {returns 0}
  941.         48,17,100,27,STATIC,LEFT,"High range value", {edit string}
  942.         48,29,100,39,STATIC,LEFT,"Low range value", {edit string}
  943.         20,5,105,45,BTN,GROUP,"Numeric Input", {edit string}
  944.         25,17,45,27,EDIT,NUMBER,HiRange$,HiRange$,
  945.         25,29,45,39,EDIT,NUMBER,LoRange$,LoRange$,
  946.         110,5,145,20,BTN,PUSH,"&OK")  {returns 1}
  947.     Return
  948.  
  949.  
  950. ShowFunctionDialog3: {subroutine: three numeric inputs}
  951.     Fdx2 = Fdx1 + 150
  952.     Fdy2 = Fdy1 + 65
  953.     DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,
  954.         5,15,24,24,QUESTION,
  955.         110,35,145,50,"&Cancel",8,Res,  {returns 0}
  956.         48,17,100,27,STATIC,LEFT,"High range value", {edit string}
  957.         48,29,100,39,STATIC,LEFT,"Mid range value", {edit string}
  958.         48,41,100,51,STATIC,LEFT,"Low range value", {edit string}
  959.         20,5,105,55,BTN,GROUP,"Numeric Input", {edit string}
  960.         25,17,45,27,EDIT,NUMBER,HiRange$,HiRange$,
  961.         25,29,45,39,EDIT,NUMBER,MidRange$,MidRange$,
  962.         25,41,45,51,EDIT,NUMBER,LoRange$,LoRange$,
  963.         110,15,145,30,BTN,PUSH,"&OK")  {returns 1}
  964.     Return
  965.  
  966. ShowFunctionDialog4: {subroutine: four numeric inputs eg for rectangle coordinates }
  967.     Fdx2 = Fdx1 + 150
  968.     Fdy2 = Fdy1 + 75
  969.     DialogBox(Fdx1, Fdy1,Fdx2,Fdy2,FunctionDialogTitle$,CAP_NCTR,
  970.         5,15,24,24,QUESTION,
  971.         110,35,145,50,"&Cancel",10,Res,  {returns 0}
  972.         48,17,100,27,STATIC,LEFT,"X1 value", {edit string}
  973.         48,29,100,39,STATIC,LEFT,"Y1 value", {edit string}
  974.         48,41,100,51,STATIC,LEFT,"X2 value", {edit string}
  975.         48,53,100,63,STATIC,LEFT,"X2 value", {edit string}
  976.         20,5,105,67,BTN,GROUP,"Rectangle Coord Input", {edit string}
  977.         25,17,45,27,EDIT,NUMBER, rX1$,rX1$,
  978.         25,29,45,39,EDIT,NUMBER,rY1$,rY1$,
  979.         25,41,45,51,EDIT,NUMBER,rX2$,rX2$,
  980.         25,53,45,63,EDIT,NUMBER,rY2$,rY2$,
  981.         110,15,145,30,BTN,PUSH,"&OK")  {returns 1}
  982.  
  983.     Return
  984.  
  985. ShowListingControl: {subroutine}
  986.     Fdx2 = Fdx1 + 210
  987.     Fdy2 = Fdy1 + 160
  988.     Msg$ = "Fill this string with the initial text, eg with FileRead_ASCII"
  989.  
  990.     DialogBox(Fdx1,Fdy1,Fdx2,Fdy2,"Edit Control Dialog Box", CAP_NCTR,
  991.                15,25, 48,48, ICON01, 
  992.               30,145,80,158,"&Cancel", 2, Res,
  993.               130,145,180,158,BTN, PUSH,"&OK",
  994.               5,5,205,143,EDIT,MLSTRING,Msg$,Res2$)
  995.  
  996.     Return
  997.  
  998. ShowUserIDPassword: {subroutine}
  999.     Fdx2 = Fdx1 + 230
  1000.     Fdy2 = Fdy1 + 90
  1001.     Msg$ = "Please enter your UserID and Password"
  1002.     Info$ = "Information"
  1003.     MoreInfo$ = "User IDs and Passwords are automatically checked by the Server. Once verified you will be logged into your secure user account."
  1004.     DialogBox(Fdx1,Fdy1,Fdx2,Fdy2,"Custom Password Box using DialogBox command", CAP_NCTR,
  1005.                350,110, 64,64, WINLOGO, 
  1006.                170,15,220,30,"&Cancel", 6, Res, {returns 0}
  1007.                170,35,220,50,BTN,PUSH,"&OK", {returns 1}
  1008.                 25,2,165,18,STATIC, LEFT, Msg$ ,
  1009.                 4,17,160,30,EDIT,STRING,"",UserID$,
  1010.                 4,37,160,50,EDIT,PASSWORD,"",Pwd$,
  1011.                 4,52,160,88,BTN,GROUP,Info$,
  1012.                 6,60,158,87,STATIC,LEFT,MoreInfo$)
  1013.  
  1014.     Return
  1015.  
  1016. ShowMessageBox: {subroutine}
  1017.     MessageBox(OKCANCEL,1,ICON01,"Message","Title",Res)
  1018.     Return
  1019.  
  1020. ShowTextBox: {subroutine}
  1021.     TextBox("This is the text.","This is the caption",Output$,Btn)
  1022.     Return
  1023.  
  1024. ShowListBox: {subroutine}
  1025.     ListBox("This is the caption","item#1|item#2|item#3","|",Res$)
  1026.     Return
  1027.  
  1028. ShowImageBox: {subroutine}
  1029.     ImageBox("Title String",ImageFile$,Text$,"Btn#1","Btn#2",Btn)
  1030.     Return
  1031.  
  1032. ShowMonthCalControl: {subroutine}
  1033.     MonthCalControl(20,30, "Display this month and next month", 2, 
  1034.         TODAY,TODAYCIRCLE,WEEKNUMBERS, 
  1035.         MOVE, WDDDMYYYY,TimeString$, Result)
  1036.     Return
  1037.  
  1038. ShowIPAddressBox: {subroutine}
  1039.     IPAddressBox(10,40,210,70,Res)
  1040.     Button(220,40,320,70,PUSH,"IP Done",GettingIPAddress)
  1041.     Return
  1042.  
  1043. GettingIPAddress:
  1044.     WaitInput(1)
  1045.     GetIPAddress(P,A,B,C,D)
  1046.     IPAddressBox(0,0,0,0,Res)
  1047.     Button()
  1048.     DrawBackground
  1049.     DrawNumber(10,40,A) DrawNumber(50,40,B) 
  1050.  
  1051.     DrawNumber(90,40,C) DrawNumber(130,40,D)
  1052.     Goto Wait_for_Input
  1053.  
  1054.